# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=avogadrolibs
pkgver=1.91.0
pkgrel=1
pkgdesc="Libraries that provide 3D rendering, visualization, analysis and data processing useful in computational chemistry, molecular modeling, bioinformatics, materials science, and related areas"
arch=(x86_64)
url="http://www.openchemistry.org/"
license=(custom)
depends=(molequeue glew spglib libmsym libarchive)
makedepends=(cmake eigen python2 boost)
source=($pkgname-$pkgver.tar.gz::"https://github.com/OpenChemistry/avogadrolibs/archive/$pkgver.tar.gz")
sha256sums=('752933c26b46dfbf12f7537b1f8dd9960a4fd29f0cccbed5b868b00474bb42af')

prepare() {
  mkdir -p build
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DOpenGL_GL_PREFERENCE=GLVND
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
  install -Dm644 "$srcdir"/$pkgname-$pkgver/LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname

  rm "$pkgdir"/usr/lib/libjsoncpp.a # provided by jsoncpp
}
